package com.geekca.d4;

public class ArrayDemo1 {
    public static void main(String[] args) {
        /**
         * 数组定义
         * 静态初始化
         */
        double[] scores = new double[]{89.9, 99.5, 59.5, 88.0};

        int[] myCounts = new int[]{723,423,423,4234};
        //简写
        int[] numbers = {1,3,4,3,451};

        int[] ages = {18,23,33,43};

        //访问元素
        System.out.println(ages[0]);
        System.out.println(ages[ages.length - 1]);
        System.out.println("=================");

        System.out.println("元素个数:"+ ages.length);
        System.out.println("=================");
        for (int i = 0; i < ages.length; i++ ) {
            System.out.print(ages[i]+" ");

        }
        System.out.println();

        ages[1]=99;

        for (int i = 0; i < ages.length; i++) {
            System.out.print(ages[i]+" ");

        }

    }
}
